﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="StockJournal.aspx.cs" Inherits="Main_Inventory_StockJournal"  Culture="en-GB"%>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Stock Journal</title>
    <link href="../../Styles/accounts.css" rel="stylesheet" type="text/css" />
          <script src="../../JavaScript/Commons.js" type="text/javascript"></script>

    <script type="text/javascript">
        var ff = 'physical';
        function Enable() {
            return true;
        }
        function Desable() {
            return false;
        }
        function EnabledTabKey(id, e) {
            var keycode;
            if (window.event) {
                keycode = window.event.keyCode;
            }
            else if (e) {
                keycode = e.which;
            }
            else {
                return true;
            }

            if (keycode == 9) {
                // if is the tab key                
                return true;
            }
            else {
                return false;
            }
        }

        function GetLastNumber(sText) {
            var Char;
            var lastRow = 0;
            for (i = 0; i < sText.length; i++) {
                Char = sText.charAt(i);
                if (!isNaN(parseFloat(Char))) {
                    lastRow = sText.toString().substr(i);
                    break;
                }
            }
            return lastRow;
        }
        function GetQuantity(hidItemId, CtrlId, HidLocationId) {
            var ddl = document.getElementById(hidItemId).value;
            if (ddl != '' && parseFloat(ddl) > 0) {
                var ctrlIndex = HidLocationId.toString();
                var LocationIdandQty = document.getElementById(ctrlIndex).value;
                window.open('StockJournalQty.aspx?ItemId=' + ddl + '&CtrlId=' + CtrlId + '&HidLocationId=' + HidLocationId + '&LocationIdandQty=' + LocationIdandQty, '', 'width=700, height=400, resizable=0');
                return false;
            }
            else {
                alert('Choose Item First');
                return false;
            }
        }
        function GetQuantityProd(hidItemId, CtrlId, HidLocationId) {
            var ddl = document.getElementById(hidItemId).value;
            if (ddl != '' && parseFloat(ddl) > 0) {
                var ctrlIndex = HidLocationId.toString();
                var LocationIdandQty = document.getElementById(ctrlIndex).value;
                window.open('StockJournalPRODQty.aspx?ItemId=' + ddl + '&CtrlId=' + CtrlId + '&HidLocationId=' + HidLocationId + '&LocationIdandQty=' + LocationIdandQty, '', 'width=700, height=400, resizable=0');
                return false;
            }
            else {
                alert('Choose Item First');
                return false;
            }
        }
        function GetQuantityTransfer(hidItemId, CtrlId, HidLocationId, SendLoacationId) {
            var ddl = document.getElementById(hidItemId).value;
            if (ddl != '' && parseFloat(ddl) > 0) {
                var ctrlIndex = HidLocationId.toString();
                var LocationIdandQty = document.getElementById(ctrlIndex).value;
                window.open('StockJournalQty.aspx?ItemId=' + ddl + '&CtrlId=' + CtrlId + '&HidLocationId=' + HidLocationId + '&LocationIdandQty=' + LocationIdandQty + '&SendLoacationId=' + SendLoacationId + '', '', 'width=700, height=400, resizable=0');
                return false;
            }
            else {
                alert('Choose Item First');
                return false;
            }
        }
        function CalculateAmtBillLevel(Table_alias) {
            if (Table_alias == 'physical') {
                var Count = document.getElementById("hid" + Table_alias + "Count").value;
                var TotalQty = 0;
                var TotalAmount = 0;
                var TotalTax = 0;
                for (var i = 1; i <= Count; i++) {
                    var Qty = document.getElementById("txt" + Table_alias + "quantity" + i);
                    var RateAmt = document.getElementById("txt" + Table_alias + "rate" + i);
                    var ItemAmount = document.getElementById("txt" + Table_alias + "amount" + i);
                    var itemAmt = 0;
                    var taxAmt = 0;
                    if (Qty.value != '' && parseFloat(Qty.value) > 0) {
                        TotalQty += parseFloat(Qty.value);
                        if (RateAmt.value != '' && parseFloat(RateAmt.value) > 0) {
                            itemAmt = parseFloat(Qty.value) - parseFloat(RateAmt.value);
                        }
                        document.getElementById("txt" + Table_alias + "amount" + i).value = parseFloat(itemAmt);
                    }
                }
            }
            else if (Table_alias == 'production') {
                var noofText = document.getElementById("hidproductionCount").value;
                var tot = 0;
                var Count = document.getElementById("hid" + Table_alias + "Count").value;
                var TotalQty = 0;
                var TotalAmount = 0;
                var TotalTax = 0;
                for (var i = 1; i <= Count; i++) {
                    var Qty = document.getElementById("txt" + Table_alias + "quantity" + i);
                    var RateAmt = document.getElementById("txt" + Table_alias + "rate" + i);
                    var ItemAmount = document.getElementById("txt" + Table_alias + "amount" + i);
                    var itemAmt = 0;
                    var taxAmt = 0;
                    if (Qty.value != '' && parseFloat(Qty.value) > 0) {
                        TotalQty += parseFloat(Qty.value);
                        if (RateAmt.value != '' && parseFloat(RateAmt.value) > 0) {
                            itemAmt = parseFloat(Qty.value) * parseFloat(RateAmt.value);
                        }
                        document.getElementById("txt" + Table_alias + "amount" + i).value = parseFloat(itemAmt).toFixed(2);
                    }
                }
                for (var u = 1; u <= noofText; u++) {
                    if (document.getElementById("txt" + Table_alias + "quantity" + u).value != '' && document.getElementById("txt" + Table_alias + "rate" + u).value != '') {
                        tot += parseFloat(document.getElementById("txt" + Table_alias + "amount" + u).value);
                    }
                }
                document.getElementById("txtprodrate").value = tot;
                var prodQty = document.getElementById("txtprodquantity").value;
                if (prodQty == '') {
                    prodQty = '0';
                }
                document.getElementById("txtprodamount").value = parseFloat(parseFloat(tot) * parseFloat(prodQty)).toFixed(2);
            }
            else {
                var Count = document.getElementById("hid" + Table_alias + "Count").value;
                var TotalQty = 0;
                var TotalAmount = 0;
                var TotalTax = 0;
                for (var i = 1; i <= Count; i++) {
                    var Qty = document.getElementById("txt" + Table_alias + "quantity" + i);
                    var RateAmt = document.getElementById("txt" + Table_alias + "rate" + i);
                    var ItemAmount = document.getElementById("txt" + Table_alias + "amount" + i);
                    var itemAmt = 0;
                    var taxAmt = 0;
                    if (Qty.value != '' && parseFloat(Qty.value) > 0) {
                        TotalQty += parseFloat(Qty.value);
                        if (RateAmt.value != '' && parseFloat(RateAmt.value) > 0) {
                            itemAmt = parseFloat(Qty.value) * parseFloat(RateAmt.value);
                        }
                        document.getElementById("txt" + Table_alias + "amount" + i).value = parseFloat(itemAmt).toFixed(2);
                    }
                }
            }
        }
        function checkItemRepetion(id, tablesource) {
            var flag = new Boolean(true);
            if (document.getElementById("hid_TFOID").value == '5') {
                var ddl = document.getElementById(id);
                if (LocationFirst()) {
                    var currentValue = ddl.options[ddl.selectedIndex].value;
                    var Count = document.getElementById("hid" + tablesource + "Count").value;
                    for (var i = 1; i <= Count; i++) {
                        var previous = document.getElementById("ddl" + tablesource + "items" + i);
                        var previousValue = previous.options[previous.selectedIndex].value;
                        if (ddl != previous) {
                            if (ddl.value == '0') {
                                document.getElementById("txt" + tablesource + "unit" + i).value = '';
                                flag = false;
                            }
                            else if (currentValue == previousValue) {
                                alert('Please Select Unique Item');
                                ddl.selectedIndex = 0;
                                flag = false;
                                break;
                            }
                        }
                    }
                }
                else {
                    ddl.value = '0';
                    flag = false;
                }

            }
            else {
                var ddl = document.getElementById(id);
                var currentValue = ddl.options[ddl.selectedIndex].value;
                var Count = document.getElementById("hid" + tablesource + "Count").value;
                var lastno = GetLastNumber(id);
                for (var i = 1; i <= Count; i++) {
                    var previous = document.getElementById("ddl" + tablesource + "items" + i);
                    var previousValue = previous.options[previous.selectedIndex].value;
                    if (ddl.value == '0') {
                        document.getElementById("txt" + tablesource + "unit" + lastno).value = '';
                        document.getElementById("txt" + tablesource + "quantity" + lastno).value = '';
                        document.getElementById("txt" + tablesource + "rate" + lastno).value = '';
                        document.getElementById("txt" + tablesource + "amount" + lastno).value = '';
                        document.getElementById("hid" + tablesource + "Location" + lastno).value = '';
                        flag = false;
                    }
                    else if (ddl != previous) {
                        if (currentValue == previousValue) {
                            alert('Please Select Unique Item');
                            ddl.selectedIndex = 0;
                            flag = false;
                            break;
                        }
                    }
                }
            }
            if (flag == true) {
                setTimeout('__doPostBack(\'' + id + '\',\'\')', 0);
            }
            return flag;
        }

        function Validate() {
            var flag = true;
            if (document.getElementById("ddljrnFormate").value == '0') {
                alert("Select Journal Format !!!");
                document.getElementById("ddljrnFormate").focus();
                flag = false;
            }
            else if (document.getElementById("txtjrnno").value == '') {
                alert("Enter Journal No !!!");
                document.getElementById("txtjrnno").focus();
                flag = false;
            }
            else if (document.getElementById("txtdate").value == '') {
                alert("Date Cannot be blank !!!");
                document.getElementById("txtdate").focus();
                flag = false;
            }
            else if (document.getElementById("hid_TFOID").value == '1') // input
            {
                if (document.getElementById("ddlinputitems1").selectedIndex == 0) {
                    alert('Please Select At Least One Item in Input');
                    document.getElementById("ddlinputitems1").focus();
                    flag = false;
                }
                else if (document.getElementById("txtinputquantity1").value == '') {
                    alert('Please Specify Quantity For First Item in Input');
                    document.getElementById("txtinputquantity1").focus();
                    flag = false;
                }
                else if (document.getElementById("txtinputrate1").value == '') {
                    alert('Please Specify Rate Inclusive Tax in Input');
                    document.getElementById("txtinputrate1").focus();
                    flag = false;
                }
                else if (document.getElementById("ddloutputitems1").selectedIndex == 0) {
                    alert('Please Select At Least One Item in Output');
                    document.getElementById("ddloutputitems1").focus();
                    flag = false;
                }
                else if (document.getElementById("txtoutputquantity1").value == '') {
                    alert('Please Specify Quantity For First Item in Output');
                    document.getElementById("txtoutputquantity1").focus();
                    flag = false;
                }
                else if (document.getElementById("txtoutputrate1").value == '') {
                    alert('Please Specify Rate Inclusive Tax in Output');
                    document.getElementById("txtoutputrate1").focus();
                    flag = false;
                }
            }
            else if (document.getElementById("hid_TFOID").value == '2') { //Production
                var noofrows = document.getElementById("hidproductionCount").value;
               // alert(document.getElementById("ddlproditem").value);
                if (document.getElementById("ddlproditem").value == '0') {
                    alert('Choose Production Item');
                    document.getElementById("ddlproditem").focus();
                    flag = false;
                }
                else {
                    for (var i = 1; i <= noofrows; i++) {
                        if (document.getElementById("hidproductionLocation" + i).value == '' && document.getElementById("ddlproductionitems" + i).value != '0') {
                            alert('Specify Quantity at row no ' + i);
                            flag = false;
                            break;
                        }
                    }
                }
            }
            else if (document.getElementById("hid_TFOID").value == '3') // Issue
            {
                if (document.getElementById("ddlissueitems1").selectedIndex == 0) {
                    alert('Please Select At Least One Item ');
                    document.getElementById("ddlissueitems1").focus();
                    flag = false;
                }
                else if (document.getElementById("txtissuequantity1").value == '') {
                    alert('Please Specify Quantity For First Item');
                    document.getElementById("txtissuequantity1").focus();
                    flag = false;
                }
                else if (document.getElementById("txtissuerate1").value == '') {
                    alert('Please Specify Rate Inclusive Tax');
                    document.getElementById("txtissuerate1").focus();
                    flag = false;
                }
            }
            else if (document.getElementById("hid_TFOID").value == '4') // recieved
            {
                if (document.getElementById("ddlrecieveditems1").selectedIndex == 0) {
                    alert('Please Select At Least One Item ');
                    document.getElementById("ddlrecieveditems1").focus();
                    flag = false;
                }
                else if (document.getElementById("txtrecievedquantity1").value == '') {
                    alert('Please Specify Quantity For First Item');
                    document.getElementById("txtrecievedquantity1").focus();
                    flag = false;
                }
                else if (document.getElementById("txtrecievedrate1").value == '') {
                    alert('Please Specify Rate Inclusive Tax');
                    document.getElementById("txtrecievedrate1").focus();
                    flag = false;
                }
            }
            else if (document.getElementById("hid_TFOID").value == '5') // transfer
            {
                if (document.getElementById("ddlfromLoacation").selectedIndex == 0) {
                    alert('Please Select From Location');
                    document.getElementById("ddlfromLoacation").focus();
                    flag = false;
                }
                else if (document.getElementById("ddlToLoacation").selectedIndex == 0) {
                    alert('Please Select To Location');
                    document.getElementById("ddlToLoacation").focus();
                    flag = false;
                }
                else if (document.getElementById("ddltransferitems1").selectedIndex == 0) {
                    alert('Please Select At Least One Item ');
                    document.getElementById("ddltransferitems1").focus();
                    flag = false;
                }
                else if (document.getElementById("txttransferquantity1").value == '') {
                    alert('Please Specify Quantity For First Item');
                    document.getElementById("txttransferquantity1").focus();
                    flag = false;
                }
                else if (document.getElementById("txttransferrate1").value == '') {
                    alert('Please Specify Rate Inclusive Tax');
                    document.getElementById("txttransferrate1").focus();
                    flag = false;
                }
            }
            else if (document.getElementById("hid_TFOID").value == '6') // physical
            {
                if (document.getElementById("ddlphysicalitems1").selectedIndex == 0) {
                    alert('Please Select At Least One Item ');
                    document.getElementById("ddlphysicalitems1").focus();
                    flag = false;
                }
                else if (document.getElementById("txtphysicalquantity1").value == '') {
                    alert('Please Specify Quantity For First Item');
                    document.getElementById("txtphysicalquantity1").focus();
                    flag = false;
                }
                else if (document.getElementById("txtphysicalrate1").value == '') {
                    alert('Please Specify Rate Inclusive Tax');
                    document.getElementById("txtphysicalrate1").focus();
                    flag = false;
                }
            }
            return flag;
        }
        function ValidateLocation() {
            if (document.getElementById("ddlfromLoacation").value == document.getElementById("ddlToLoacation").value) {
                alert('Transfer Location Cannot be same!');
                return false;
            }
            return true;
        }
        function LocationFirst() {
            var flag = true;
            if (document.getElementById("ddlfromLoacation").value == '0') {
                alert('Choose From Location First');
                document.getElementById("ddlfromLoacation").focus();
                flag = false;
            }
            else {
                flag = true;
            }
            return flag;
        }           
    </script>
</head>
<body>
    <form id="form1" runat="server">
         <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
           <ProgressTemplate>
             <center> <img src="../../Images/ajax-loader.gif" alt="Loading...." /></center>
           </ProgressTemplate>
        </asp:UpdateProgress>
         <div class="divmain" style="width:98%; margin-left:1%;">
            <acc:heading ID="pagehead" runat="server" HeadingText="Stock Journal" />   
         <div style="margin-left:3%; margin-right:2%; width:100%" align="center">
            <asp:Label ID="lblMsg" runat="server" Font-Bold="true"></asp:Label>
         </div>   
         </div>
        <div style="width:110%; margin-left:1%;">
           <table id="maintable" runat="server" class="tablecontent" style="width:98%; height:100%;">
             <tr>
               <td class="headtd" colspan="6">Stock Journal</td>
             </tr>
             <tr style="margin-top:10px;">
               <td><b>Journal Format</b><span style="color:Red">*</span></td><td>
                 <asp:DropDownList CssClass="dropdown" ID="ddljrnFormate" runat="server" 
                     onselectedindexchanged="ddljrnFormate_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
                     <asp:HiddenField ID="hid_TFOID" runat="server" />
                     </td>
               <td><b>Journal No</b> <span style="color:Red">*</span></td>
                               <td>
                                    <asp:TextBox ID="txtPrefix" runat="server" Width="70px" CssClass="input" onKeyPress="return false" onKeydown="return false"></asp:TextBox>
                                    <AjaxControl:TextBoxWatermarkExtender ID="prefixWater" runat="server" TargetControlID="txtPrefix" WatermarkText="Prefix" WatermarkCssClass="watermark_textbox"></AjaxControl:TextBoxWatermarkExtender>
                                    <asp:TextBox ID="txtjrnno" runat="server" Width="70px" CssClass="inputnumber" ValidationGroup="V" MaxLength="10"  ></asp:TextBox>
                                    <AjaxControl:TextBoxWatermarkExtender ID="voucherWater" runat="server" TargetControlID="txtjrnno" WatermarkText="Number" WatermarkCssClass="watermark_textbox"></AjaxControl:TextBoxWatermarkExtender>                            
                                    <asp:TextBox ID="txtSuffix" runat="server" Width="70px" CssClass="input" onKeyPress="return false" onKeydown="return false"></asp:TextBox>
                                    <AjaxControl:TextBoxWatermarkExtender ID="suffixWater" runat="server" TargetControlID="txtSuffix" WatermarkText="Suffix" WatermarkCssClass="watermark_textbox"></AjaxControl:TextBoxWatermarkExtender>
                               </td>
               <td><b>Date</b><span style="color:Red">*</span></td><td><asp:TextBox ID="txtdate" runat="server" ValidationGroup="S"></asp:TextBox>
                  <asp:ImageButton ID="btnDate" runat="server" ImageUrl="~/Images/calendar.gif" />
                                <AjaxControl:CalendarExtender ID="cal" runat="server" PopupButtonID="btnDate" TargetControlID="txtdate" Format="dd/MM/yyyy"></AjaxControl:CalendarExtender>
                                <AjaxControl:MaskedEditExtender ID="maskExt" runat="server" MaskType="Date" Mask="99/99/9999" TargetControlID="txtdate"></AjaxControl:MaskedEditExtender>
                                <AjaxControl:MaskedEditValidator ID="maskValid" runat="server" ControlExtender="maskExt" ValidationGroup="S" InvalidValueMessage="Invalid Date" IsValidEmpty="true" Display="Dynamic"  ControlToValidate="txtdate"></AjaxControl:MaskedEditValidator>  
               </td>                
             </tr>
             <tr >
                   <td style="width:100%;" colspan="6" id="tdfromto" runat="server" visible="false">
                     <table style="width:98%; margin:1%;" class="tablecontent">
                       <tr>
                         <td>From Location <span style="color:Red">*</span></td><td><asp:DropDownList CssClass="dropdown" ID="ddlfromLoacation" runat="server" onchange="ValidateLocation();" OnSelectedIndexChanged="ddlFromLoacation_SelectedIndexChanged"></asp:DropDownList><asp:HiddenField ID="hidfromLoacation" runat="server" /></td>
                         <td>To Location <span style="color:Red">*</span></td><td><asp:DropDownList CssClass="dropdown" ID="ddlToLoacation" runat="server" onchange="ValidateLocation();" OnSelectedIndexChanged="ddlToLoacation_SelectedIndexChanged"></asp:DropDownList><asp:HiddenField ID="hidToLoacation" runat="server" /></td>
                       </tr>
                     </table>
                   </td>
             </tr>
             <tr>
               <td style="width:100%;" colspan="6" id="tbl_production_first" runat="server" visible="false" >
                 <asp:HiddenField ID="hidproductionFirstCount" runat="server" Value="1" />
                   <table style="width:98%; margin:1%;" class="tablecontent">
                       <tr>
                          <td colspan="2"><b>Production/Conversion</b></td>
                       </tr>
                       <tr>
                             <td><b>Item (s)</b></td><td><asp:DropDownList CssClass="dropdown" ID="ddlproditem" runat="server" AutoPostBack="true" OnSelectedIndexChanged="prod_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                             <td>
                                 <b>Quantity</b></td><td><asp:TextBox ID="txtprodquantity" runat="server" CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btnprodQty" runat="server" Text="..."  Width="5%" CssClass="button"/>
                                 <asp:HiddenField ID="hidprodLocation" runat="server" /><asp:Button ID="btnhidFire" runat="server" style="display:none;" OnClick="BindItemBom" />
                             </td>
                      </tr>
                      <tr>
                        <td><b>Unit</b></td><td><asp:TextBox ID="txtprodunit" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);" ></asp:TextBox><asp:HiddenField ID="hidproduomid" runat="server" /><asp:HiddenField ID="hidprodBOM" runat="server" /></td>
                        <td><b>Rate</b></td><td><asp:TextBox ID="txtprodrate" runat="server" CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                        <td><b>Amount</b></td><td><asp:TextBox ID="txtprodamount" runat="server" CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"> </asp:TextBox></td>
                      </tr>
                   </table>
                   <span id="spnconsume" runat="server" style="margin-left:1%; font-weight:bold;" visible="false">Items Consumed</span>
               </td>
             </tr>
             <tr>
               <td  colspan="6" >
               <asp:HiddenField ID="hidphysicalCount" Value="2" runat="server" /> 
                  <table id="tbl_physical" runat="server" style="width:98%; margin:1%;" class="tablecontent"   visible="false">
                        <tr>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:19%;" class="headtd">Item (s)</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:19%;" class="headtd">Unit</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:19%;" class="headtd">Book Balance</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:19%;" class="headtd">Physical Stock</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:19%;" class="headtd">Difference</td>
                                <td align="center" style="border-bottom:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Reason</td>
                        </tr>
                        <tr>
                                <td align="center" style="width:19%;"><asp:DropDownList CssClass="dropdown" ID="ddlphysicalitems1" runat="server" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'physical')" OnSelectedIndexChanged="physical_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                                <td align="center" style="width:19%;"><asp:TextBox ID="txtphysicalunit1" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidphysicaluomid1" runat="server" /></td>
                                <td align="center" style="width:19%;"><asp:TextBox ID="txtphysicalquantity1" runat="server"  CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btnphysicalQty1" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidphysicalLocation1" runat="server" /></td>
                                <td align="center" style="width:19%;"><asp:TextBox ID="txtphysicalrate1" runat="server" CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" onBlur="return CalculateAmtBillLevel('physical');"></asp:TextBox></td>       <%-- Physical Stock--%>
                                <td align="center" style="width:19%;"><asp:TextBox id="txtphysicalamount1" runat="server" CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td> <%-- Physical Difference--%>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtphysicalreason1" runat="server" CssClass="input" ></asp:TextBox></td>
                        </tr>
                        <tr>
                             <td align="center" style="width:19%;"><asp:DropDownList CssClass="dropdown" ID="ddlphysicalitems2" runat="server" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'physical');" OnSelectedIndexChanged="physical_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                             <td align="center" style="width:19%;"><asp:TextBox ID="txtphysicalunit2" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidphysicaluomid2" runat="server" /></td>
                             <td align="center" style="width:19%;"><asp:TextBox ID="txtphysicalquantity2" runat="server"  CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btnphysicalQty2" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidphysicalLocation2" runat="server" /></td>
                             <td align="center" style="width:19%;"><asp:TextBox ID="txtphysicalrate2" runat="server"  CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" onBlur="return CalculateAmtBillLevel('physical');"></asp:TextBox></td>       <%-- Physical Stock--%>
                             <td align="center" style="width:19%;"><asp:TextBox id="txtphysicalamount2" runat="server"  CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td> <%-- Physical Difference (txtphysicaldifference)--%>
                             <td align="center" style="width:20%;"><asp:TextBox ID="txtphysicalreason2" runat="server" CssClass="input"></asp:TextBox></td>
                      </tr>
                      
                  </table>
                  <table id="tbl_physical_btn" runat="server" style="width:100%; margin-left:25px;" visible="false">
                      <tr>
                           <td  align="left"><asp:Button ID="btnphyaddmore" CssClass="button" runat="server" 
                                   Text="Add More" onclick="btnphyaddmore_Click" />&nbsp;&nbsp;</td>  
                      </tr>
                  </table>
               </td>
             </tr>
             <tr>
             <td colspan="6" >
             <asp:HiddenField ID="hidjounalCount" Value="2" runat="server" /> 
             <table id="tbl_jounal" runat="server" style="width:98%; margin:1%;" class="tablecontent"  visible="false" >
                        <tr>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Item (s)</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Unit</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Quantity</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Rate</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Amount</td>
                        </tr>
                        <tr>
                                <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown" ID="ddljounalitems1" runat="server" AutoPostBack="true" ></asp:DropDownList></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtjounalunit1" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidjounaluomid1" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtjounalqty1" runat="server" CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btnjounalqty1" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidjounalLocation1" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox id="txtjounalrate1" runat="server" CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" ></asp:TextBox></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtjounalamount1" runat="server" CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                        </tr>
                        <tr>
                                <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown" ID="ddljounalitems2" runat="server" AutoPostBack="true"></asp:DropDownList></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtjounalunit2" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidjounaluomid2" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtjounalqty2" runat="server" CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btnjounalqty2" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidjounalLocation2" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox id="txtjounalrate2" runat="server" CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" ></asp:TextBox></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtjounalamount2" runat="server" CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                      </tr>
                      
                  </table>
                  <table id="tbl_jounal_btn" runat="server" style="width:100%; margin-left:25px;" visible="false">
                       <tr>
                           <td align="left"><asp:Button ID="btnjounaladdmore" CssClass="button" runat="server" Text="Add More" />&nbsp;&nbsp;</td>  
                      </tr>
                  </table>
                  <asp:HiddenField ID="hidproductionCount" Value="2" runat="server" /> 
                  <table id="tbl_production" runat="server" style="width:98%; margin:1%;" class="tablecontent"  visible="false" >
                        <tr>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Item (s)</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Unit</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Quantity</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Rate</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Amount</td>
                        </tr>
                        <tr>
                                <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown" ID="ddlproductionitems1" runat="server" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'production');" OnSelectedIndexChanged="production_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtproductionunit1" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidproductionuomid1" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtproductionquantity1" runat="server" CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btnproductionqty1" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidproductionLocation1" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox id="txtproductionrate1" runat="server" CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" onBlur="return CalculateAmtBillLevel('production');"></asp:TextBox></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtproductionamount1" runat="server"  CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                        </tr>
                        <tr>
                                <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown" ID="ddlproductionitems2" runat="server" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'production');" OnSelectedIndexChanged="production_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtproductionunit2" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidproductionuomid2" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtproductionquantity2" runat="server"  CssClass="DisableInputNumber"  onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btnproductionqty2" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidproductionLocation2" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox id="txtproductionrate2" runat="server" CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" onBlur="return CalculateAmtBillLevel('production');"></asp:TextBox></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtproductionamount2" runat="server"  CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                      </tr>
                      
                  </table>
                    <table id="tbl_production_btn" runat="server" style="width:100%; margin-left:25px;" visible="false">
                       <tr>
                           <td  align="left"><asp:Button ID="btnproductionaddmore" CssClass="button" 
                                   runat="server" Text="Add More" onclick="btnproductionaddmore_Click" />&nbsp;&nbsp;</td>  
                      </tr>
                  </table>
                   <asp:HiddenField ID="hidissueCount" Value="2" runat="server" /> 
                  <table id="tbl_issue" runat="server" style="width:98%; margin:1%;" class="tablecontent"  visible="false" >
                        <tr>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Item (s)</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Unit</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Quantity</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Rate</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Amount</td>
                        </tr>
                        <tr>
                                <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown"   ID="ddlissueitems1" runat="server" Width="95%" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'issue');" OnSelectedIndexChanged="issue_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtissueunit1" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidissueuomid1" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtissuequantity1" runat="server" CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btnissueqty1" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidissueLocation1" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox id="txtissuerate1" runat="server" CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" onBlur="return CalculateAmtBillLevel('issue');"></asp:TextBox></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtissueamount1" runat="server" CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                        </tr>
                        <tr>
                                <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown" ID="ddlissueitems2" runat="server" Width="95%" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'issue');" OnSelectedIndexChanged="issue_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtissueunit2" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidissueuomid2" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtissuequantity2" runat="server" CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btnissueqty2" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidissueLocation2" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox id="txtissuerate2" runat="server" CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" onBlur="return CalculateAmtBillLevel('issue');"></asp:TextBox></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtissueamount2" runat="server" CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                      </tr>
                     
                  </table>
                  <table id="tbl_issue_btn" runat="server" style="width:100%; margin-left:25px;" visible="false">
                       <tr>
                           <td  align="left"><asp:Button ID="btnissueaddmore" CssClass="button"  
                                   runat="server" Text="Add More" onclick="btnissueaddmore_Click" />&nbsp;&nbsp;</td>  
                      </tr>
                  </table>
                   <asp:HiddenField ID="hidrecievedCount" Value="2" runat="server" /> 
                   <table id="tbl_recieved" runat="server" style="width:98%; margin:1%;" class="tablecontent"  visible="false" >
                        <tr>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Item (s)</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Unit</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Quantity</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Rate</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Amount</td>
                        </tr>
                        <tr>
                                <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown" ID="ddlrecieveditems1" runat="server" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'recieved');" OnSelectedIndexChanged="recieved_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtrecievedunit1" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidrecieveduomid1" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtrecievedquantity1" runat="server"  CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btnrecievedqty1" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidrecievedLocation1" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox id="txtrecievedrate1" runat="server"  CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);"  onBlur="return CalculateAmtBillLevel('recieved');"></asp:TextBox></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtrecievedamount1" runat="server"  CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                        </tr>
                        <tr>
                                <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown" ID="ddlrecieveditems2" runat="server" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'recieved');" OnSelectedIndexChanged="recieved_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtrecievedunit2" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidrecieveduomid2" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtrecievedquantity2" runat="server" CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btnrecievedqty2" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidrecievedLocation2" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox id="txtrecievedrate2" runat="server"  CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);"  onBlur="return CalculateAmtBillLevel('recieved');"></asp:TextBox></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txtrecievedamount2" runat="server"  CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                      </tr>
                      
                  </table>
                    <table id="tbl_recieved_btn" runat="server" style="width:100%; margin-left:25px;" visible="false">
                       <tr>
                           <td  align="left"><asp:Button ID="btnrecievedaddmore" CssClass="button" 
                                   runat="server" Text="Add More" onclick="btnrecievedaddmore_Click" />&nbsp;&nbsp;</td>  
                      </tr>
                  </table>
                   <asp:HiddenField ID="hidtransferCount" Value="2" runat="server" /> 
                   <table id="tbl_transfer" runat="server" style="width:98%; margin:1%;" class="tablecontent"  visible="false" >
                        <tr>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Item (s)</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Unit</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Quantity</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Rate</td>
                                <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Amount</td>
                        </tr>
                        <tr>
                                <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown" ID="ddltransferitems1" runat="server" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'transfer');" OnSelectedIndexChanged="transfer_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txttransferunit1" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidtransferuomid1" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txttransferquantity1" runat="server" CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btntransferqty1" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidtransferLocation1" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox id="txttransferrate1" runat="server"  CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" onBlur="return CalculateAmtBillLevel('transfer');"></asp:TextBox></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txttransferamount1" runat="server"  CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                        </tr>
                        <tr>
                                <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown" ID="ddltransferitems2" runat="server" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'transfer');" OnSelectedIndexChanged="transfer_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txttransferunit2" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidtransferuomid2" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txttransferquantity2" runat="server" CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btntransferqty2" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidtransferLocation2" runat="server" /></td>
                                <td align="center" style="width:20%;"><asp:TextBox id="txttransferrate2" runat="server" CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" onBlur="return CalculateAmtBillLevel('transfer');"></asp:TextBox></td>
                                <td align="center" style="width:20%;"><asp:TextBox ID="txttransferamount2" runat="server" CssClass="DisableInputNumber" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                      </tr>
                      
                  </table>
                     <table id="tbl_transfer_btn" runat="server" style="width:100%; margin-left:25px;" visible="false">
                      <tr>
                           <td  align="left"><asp:Button ID="btntransferaddmore" CssClass="button" 
                                   runat="server" Text="Add More" onclick="btntransferaddmore_Click" />&nbsp;&nbsp;</td>  
                      </tr>
                  </table>
               </td>
               </tr>
               <tr>
                  <td  style="width:100%;" colspan="6" >
                    <table id="tbl_inputoutput" runat="server" style="width:98%; margin:1%;" class="tablecontent"  visible="false">
                       <tr>
                         <td><b>Input</b>
                         <asp:HiddenField ID="hidinputCount" Value="2" runat="server" /> 
                            <table id="tbl_input" runat="server" style="width:98%; margin:1%;" class="tablecontent">
                                    <tr>
                                            <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Item (s)</td>
                                            <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Unit</td>
                                            <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Quantity</td>
                                            <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Rate</td>
                                            <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Amount</td>
                                    </tr>
                                    <tr>
                                            <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown" ID="ddlinputitems1" runat="server" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'input');" OnSelectedIndexChanged="input_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                                            <td align="center" style="width:20%;"><asp:TextBox ID="txtinputunit1" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidinputuomid1" runat="server" /></td>
                                            <td align="center" style="width:20%;"><asp:TextBox ID="txtinputquantity1" runat="server"  CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btninputqty1" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidinputLocation1" runat="server" /></td>
                                            <td align="center" style="width:20%;"><asp:TextBox id="txtinputrate1" runat="server"  CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" onBlur="return CalculateAmtBillLevel('input');"></asp:TextBox></td>
                                            <td align="center" style="width:20%;"><asp:TextBox ID="txtinputamount1" runat="server"  CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                            <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown" ID="ddlinputitems2" runat="server" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'input');" OnSelectedIndexChanged="input_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                                            <td align="center" style="width:20%;"><asp:TextBox ID="txtinputunit2" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidinputuomid2" runat="server" /></td>
                                            <td align="center" style="width:20%;"><asp:TextBox ID="txtinputquantity2" runat="server" CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btninputqty2" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidinputLocation2" runat="server" /></td>
                                            <td align="center" style="width:20%;"><asp:TextBox id="txtinputrate2" runat="server"  CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" onBlur="return CalculateAmtBillLevel('input');"></asp:TextBox></td>
                                            <td align="center" style="width:20%;"><asp:TextBox ID="txtinputamount2" runat="server" CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                                  </tr>
                                  
                         </table>
                          <table id="tbl_input_btn" runat="server" style="width:100%; margin-left:25px;" visible="false">
                                  <tr>
                                      <td  align="left"><asp:Button ID="btninputaddmore" CssClass="button" 
                                              runat="server" Text="Add More" onclick="btninputaddmore_Click" />&nbsp;&nbsp;</td> 
                                  </tr>
                         </table>
                       </td>
                      </tr>
                           <tr>
                               <td><b>Output</b>
                               <asp:HiddenField ID="hidoutputCount" Value="2" runat="server" />  
                                   <table id="tbl_output" runat="server" style="width:98%; margin:1%;" class="tablecontent">
                                    <tr>
                                            <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Item (s)</td>
                                            <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Unit</td>
                                            <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Quantity</td>
                                            <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Rate</td>
                                            <td align="center" style="border-bottom:1px solid #818181; border-right:1px solid #818181; font-weight:bold; width:20%;" class="headtd">Amount</td>
                                    </tr>
                                    <tr>
                                            <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown" ID="ddloutputitems1" runat="server" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'output');" OnSelectedIndexChanged="output_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                                            <td align="center" style="width:20%;"><asp:TextBox ID="txtoutputunit1" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidoutputuomid1" runat="server" /></td>
                                            <td align="center" style="width:20%;"><asp:TextBox ID="txtoutputquantity1" runat="server" CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btnoutputqty1" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidoutputLocation1" runat="server" /></td>
                                            <td align="center" style="width:20%;"><asp:TextBox id="txtoutputrate1" runat="server"  CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" onBlur="return CalculateAmtBillLevel('output');"></asp:TextBox></td>
                                            <td align="center" style="width:20%;"><asp:TextBox ID="txtoutputamount1" runat="server" CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                            <td align="center" style="width:20%;"><asp:DropDownList CssClass="dropdown" ID="ddloutputitems2" runat="server" AutoPostBack="true" onchange="return checkItemRepetion(this.id,'output');" OnSelectedIndexChanged="output_ddlitems_OnSelectedIndexChanged"></asp:DropDownList></td>
                                            <td align="center" style="width:20%;"><asp:TextBox ID="txtoutputunit2" runat="server" CssClass="DisableInput" onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox><asp:HiddenField ID="hidoutputuomid2" runat="server" /></td>
                                            <td align="center" style="width:20%;"><asp:TextBox ID="txtoutputquantity2" runat="server" CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox>&nbsp;<asp:Button ID="btnoutputqty2" runat="server" Text="..."  Width="5%" CssClass="button" /><asp:HiddenField ID="hidoutputLocation2" runat="server" /></td>
                                            <td align="center" style="width:20%;"><asp:TextBox id="txtoutputrate2" runat="server"  CssClass="inputnumber" OnKeyPress="return isNumberKey(this.ID,event);" onBlur="return CalculateAmtBillLevel('output');"></asp:TextBox></td>
                                            <td align="center" style="width:20%;"><asp:TextBox ID="txtoutputamount2" runat="server" CssClass="DisableInputNumber"   onKeyDown="return EnabledTabKey(this.id, event);"></asp:TextBox></td>
                                  </tr>
                                  
                               </table>
                                <table id="tbl_output_btn" runat="server" style="width:100%; margin-left:25px;" visible="false">
                                    <tr>
                                       <td align="left"><asp:Button ID="btnoutputaddmore" CssClass="button" 
                                               runat="server" Text="Add More" onclick="btnoutputaddmore_Click" />&nbsp;&nbsp;</td>  
                                  </tr>
                               </table>
                               </td>
                           </tr>
                    </table>
                  </td>
               </tr>
               <tr>
                 <td  colspan="6" style="width:100%;" >
                     <table id="tbl_details" runat="server" visible="false" style="width:98%; margin:1%;" class="tablecontent" >
                      <tr>
                       <td colspan="4" class="headtd"><b>Details</b></td>
                       </tr>
                        <tr>
                           <td style="margin-top:5px;" id="tdnarration" runat="server" ><b>Narration:</b></td>
                           <td style="margin-top:5px;" id="tdnarrationText" runat="server"><asp:TextBox ID="txtdetailsnarrations" runat="server"></asp:TextBox></td>
                           <td style="margin-top:5px;" id="tdpreparedby" runat="server"><b>Prepared By:</b></td>
                           <td style="margin-top:5px;" id="tdpreparedbyText" runat="server"><asp:TextBox ID="txtdetailspreparedby" runat="server"></asp:TextBox></td>
                        </tr>
                        <tr>
                          <td id="tdremarks" runat="server" ><b>Remarks:</b></td>
                          <td id="tdremarksText" runat="server" ><asp:TextBox ID="txtdetailsremarks" runat="server"></asp:TextBox></td>
                          <td id="tdcheckedby" runat="server" ><b>Checked By:</b></td>
                          <td id="tdcheckedbyText" runat="server" ><asp:TextBox ID="txtdetailscheckedby" runat="server"></asp:TextBox></td>
                        </tr>
                        <tr>
                          <td id="tdnote" runat="server" ><b>Note:</b></td>
                          <td id="tdnoteText" runat="server" ><asp:TextBox ID="txtdetailsnote" runat="server"></asp:TextBox></td>
                          <td id="tdauthorised" runat="server" ><b>Authorised Signatory:</b></td>
                          <td id="tdauthorisedText" runat="server" ><asp:TextBox ID="txtdetailsauthorisedsignatory" runat="server"></asp:TextBox></td>
                        </tr>
                     </table>
                 </td>
               </tr>
           </table>
             <table id="tblbtn" runat="server" style="width:90%;" visible="false">
                    <tr>
                        <td align="center"> 
                            <asp:Button ID="btnSave" Text="Save" runat="server" OnClick="btnSave_Click" CssClass="button"  OnClientClick="return Validate();" 
                                ValidationGroup="S"/> &nbsp;
                            <asp:Button ID="btnCancel" Text="Cancel" runat="server" CssClass="button" /> 
                        </td>
                    </tr>
            </table>
        </div>
       </ContentTemplate>
  </asp:UpdatePanel> 
 </form>
</body>
</html>
